package com.tyut.homework.controller;

import com.tyut.homework.response.ServerResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

public abstract class ControllerTemplate<T> {

    @ApiOperation("查询某个信息")
    @GetMapping("/findById/{id}")
    public abstract ServerResponse findById(@PathVariable Integer id);

    @ApiOperation("查看分页信息")
    @GetMapping("/findAll/{pageNum}/{pageLimit}")
    public abstract ServerResponse findAll(@PathVariable Integer pageNum,
                                           @PathVariable Integer pageLimit);

    @ApiOperation("添加")
    @PostMapping("/add")
    public abstract ServerResponse add(T t);

    @ApiOperation("更新信息")
    @PostMapping("/update")
    public abstract ServerResponse update(T t);

    @ApiOperation("删除单个")
    @GetMapping("/delete/{id}")
    public abstract ServerResponse delete(@PathVariable Integer id);
}
